<template>
    <div class="home">
        <!-- <img alt="Vue logo" src="../assets/logo.png">
		<HelloWorld msg="Welcome to Your Vue.js App"/> -->

        <van-nav-bar style="color: #EF1726;" :title="title" :left-text="leftText"  :left-arrow="isleftarrow"
            fixed border:="border" @click-left="$router.back()" />
        <!-- <DemoNav></DemoNav> -->


        <div style="height: 2.8rem;"></div>
        <router-view />


        <div style="height: 5rem;"></div>
        <van-tabbar v-model="active" active-color="#EF1726" @change="onChange">
            <van-tabbar-item icon="home-o" to="/">首页</van-tabbar-item>
            <van-tabbar-item icon="search" to="/searchseat">筛选</van-tabbar-item>
            <van-tabbar-item icon="friends-o" to="/selfinfo">我的</van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
    // @ is an alias to /src
    import HelloWorld from '@/components/HelloWorld.vue'
    import DemoNav from '@/components/DemoNav.vue'

    export default {
        name: 'Home',
        // props: ["title", "isleftarrow"],
        components: {
            HelloWorld,
            DemoNav
        },
        data() {
            return {
                active: '',
                border: false,
                title: '1',
                isleftarrow: true,
                leftText: '返回'
            };
        },
        methods: {
            onChange(index) {
                this.active = index;
            },
            onClickNavBarLeft() {
                history.back();
            }
        },
        created() {
            this.title = this.$route.meta.title != undefined ? this.$route.meta.title : '标题';
            this.isleftarrow = this.$route.meta.isleftarrow != undefined ? this.$route.meta.isleftarrow : true;
            if (this.isleftarrow == false)
                this.leftText = '';
        },
        mounted() {
        },
        watch: {
            $route(to, from) {
                this.title = "标题";
                this.isleftarrow = true;
                if (to.meta.title) 
                     this.title = to.meta.title;
                if (to.meta.isleftarrow) 
                    this.isleftarrow = to.meta.isleftarrow;
                
                // this.title = "标题";
                // this.isleftarrow = true;
                // this.title = to.meta.title;
                // this.isleftarrow = to.meta.isleftarrow;
            }
        }
    }
</script>

<style lang="css" scoped>
    /* /deep/ .van-ellipsis {
    color: #EE0A24;
  } */

    /deep/ .van-nav-bar .van-icon {
        color: #EF1726;
    }

    /deep/ .van-nav-bar__text {
        color: #EF1726;
    }
</style>
